package pshop.servlet.util;

import pshop.Adresse;
import pshop.Person;

import javax.servlet.http.HttpServletRequest;

public abstract class PersonUtils
{
   public static Person getPerson(HttpServletRequest req)
   {
      Person pers = new Person();
      pers.setVorname(req.getParameter("vorname"));
      pers.setName(req.getParameter("name"));
      pers.setEmail(req.getParameter("email"));
      return pers;
   }

   public static Adresse getAdresse(HttpServletRequest req)
   {
      Adresse adr = new Adresse();
      adr.setStrasse(req.getParameter("strasse"));
      adr.setNr(req.getParameter("hsnr"));
      adr.setOrt(req.getParameter("ort"));
      adr.setPlz(Integer.parseInt(req.getParameter("plz")));
      return adr;
   }
}